import { ID_CARD_DATA } from "../../Action/credit/ScanIDCardReady";
import objectAssign from "object-assign";
import {isServer} from "../../../tools/utils";
//认证结果数据
const _scanIDCardReadyInfo = {
	Name: "", //用户名
	livenessName: "", //用户名.这个用户名用于扫描人脸页面使用，在身份认证页面不清除。
	CardID: "", //身份证号
	Sex: "", //性别
	Nation: "", //民族
	BirthDate: "", //出生
	Address: "", //住址
	CardImgUrl: "", //正面，
	Authority: "", //签发机关
	Validity: "", //有效
	CardBackImgUrl: "", //反面，
	CardPersionUrl: "", //身份证头像
	reservePhone: "", //银行预留手机号
	agreeFlag: false //是否选择
};
const scanIDCardReadyInfo = isServer ? _scanIDCardReadyInfo : sessionStorage.getItem("setIDCardData")
	? JSON.parse(sessionStorage.getItem("setIDCardData"))
	: _scanIDCardReadyInfo;

const setIDCardData = (state = scanIDCardReadyInfo, action = {}) => {
	switch (action.type) {
		case ID_CARD_DATA:
			return objectAssign({}, state, action.options);
		default:
			return state;
	}
};
export default setIDCardData;
